package threadTesting;

import util.Vector;

/**
 * Created by IntelliJ IDEA.
 * User: s32465
 * Date: 09.11.2010
 * Time: 19:16:41
 * To change this template use File | Settings | File Templates.
 */
public class ReadVectorRunnable implements Runnable {
    private Vector vector;


    public ReadVectorRunnable(Vector vector) {
        
        this.vector = vector;
    }

    public void run() {
        for (int i = 0; i < this.vector.length(); i++) {
            while(!WaitReadWrite.getFlag()){}
            float value = this.vector.getElement(i);
            System.out.println("Read: " + value + " from position " + i);
            WaitReadWrite.setFlag(false);
        }
    }
}
